CSharpTest.Net
KeyComparer Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTreeOptions<TKey,TValue> Class : KeyComparer Property

Glossary Item Box

Defines a custom IComparer<T> to be used for comparing keys

Syntax

Visual Basic (Declaration) 
Public Property KeyComparer As IComparer(Of TKey)
C# 
public IComparer<TKey> KeyComparer {get; set;}

Example

BPlusTree/BPlusTree.Test/TestBulkInsert.cs

C#Copy Code
Dictionary<int, string> test = new Dictionary<int, string>();
List<IEnumerable<KeyValuePair<int, string>>> sets = 
    new List<IEnumerable<KeyValuePair<int, string>>>(CreateSets(2, 100, test));
foreach (KeyValuePair<int, string> pair in 
    OrderedKeyValuePairs<int, string>.Merge(Options.KeyComparer, DuplicateHandling.LastValueWins, sets.ToArray()))
{
    string val;
    Assert.IsTrue(test.TryGetValue(pair.Key, out val));
    Assert.AreEqual(pair.Value, val);
    Assert.IsTrue(test.Remove(pair.Key));
}

Assert.AreEqual(0, test.Count);
VB.NETCopy Code
Dim test As New Dictionary(Of Integer, String)()
Dim sets As New List(Of IEnumerable(Of KeyValuePair(Of Integer, String)))(CreateSets(2, 100, test))
For Each pair As KeyValuePair(Of Integer, String) In OrderedKeyValuePairs(Of Integer, String).Merge(Options.KeyComparer, DuplicateHandling.LastValueWins, sets.ToArray())
    Dim val As String
    Assert.IsTrue(test.TryGetValue(pair.Key, val))
    Assert.AreEqual(pair.Value, val)
    Assert.IsTrue(test.Remove(pair.Key))
Next

Assert.AreEqual(0, test.Count)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys